package test;

import java.util.Scanner;

public class ArrayUtils {
	public static void findMax(double[] arr, int i, int j) throws IllegalArgumentException {
		Scanner sc=new Scanner(System.in);
		int n = sc.nextInt();
		int[] x = new int[n];
		for (int k = 0; k < n; k++) {
			int inputInt = sc.nextInt();
			x[i] = inputInt;
		}
		while(sc.hasNext()){
			int begin = sc.nextInt();
		int end = sc.nextInt();
		throws IllegalArgumentException {
	        if (begin<=end)  {
	            throw new IllegalArgumentException("begin:"+begin+" >= end:"+end);
	        }
	   
	    throws IllegalArgumentException {
		        if (begin<0)  {
		            throw new IllegalArgumentException("begin:"+begin+" <0");
		        }
		       
		throws IllegalArgumentException {
			     if(end>arr.length)  {
			            throw new IllegalArgumentException("end:"+end+" > arr.length");
			        }
		  int max = 0;
		  for (int j1 = begin; j1 <  end - 1; j1++) {
		   for (int k = j1+1 ; k <  end - 1; k++) {
		    if (x[j1] < x[k]){
		     max = x[k];
		    }else{
		     max = x[j1];
		    }
		   }
		  }
		  System.out.println(max); 
		}
	    }}}
	}
		
}
